﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Umbrella.Whs.WhsAddin.SettingsControls
{
    public partial class About : SettingsControlBase
    {
        public About(UmbrellaSettingsTab tab)
            : base(tab)
        {
            if (_log.IsDebugEnabled)
                _log.Debug("Initialization start");

            try
            {
                InitializeComponent();
	
                // set version text
                this.aboutVersionTextLabel.Text = string.Format(
                    Properties.Resources.txtAboutVersionText,
                    UmbrellaVersion.VersionString
                    );

                this.instanceId.Text = UmbrellaRegistry.GetInstanceId().ToString();

                // done
                if (_log.IsDebugEnabled)
                    _log.Debug("Initialization done");
            }
            catch (Exception e)
            {
                _log.Fatal("Failed to initialize", e);

                throw;
            }
        }

        private void homepageLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            _tab.Services.OpenUrl(Umbrella.Whs.Properties.Constants.HomepageUrl);
        }

        private void showLicenseLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            _tab.Services.OpenUrl(Umbrella.Whs.Properties.Constants.LicenseUrl);
        }

    }
}